//
//  WDCustomManager.m
//  WDPolymerizeSDK
//
//  Created by little People on 2023/6/8.
//

#import "WDCustomManager.h"
#import "WDCustomViewController.h"
@interface WDCustomManager ()
@property (nonatomic, strong)WDCustomViewController *customVC;
@end
@implementation WDCustomManager
static WDCustomManager *_customManager = nil;
+ (instancetype)shareCustomManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _customManager = [[self alloc] init];
        
    });
    return _customManager;
}

- (void)showCustomAd
{
    
    dispatch_async(dispatch_get_main_queue(), ^{
        self.customVC = [[WDCustomViewController alloc] init];
        UIViewController *rootViewController = [[[UIApplication sharedApplication].windows objectAtIndex:0] rootViewController];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:self.customVC];
        [nav setNavigationBarHidden:YES animated:NO];
        nav.interactivePopGestureRecognizer.enabled = NO;
        rootViewController.definesPresentationContext = YES;
        nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;
        [rootViewController presentViewController:nav animated:NO completion:nil];
    });
}

@end
